home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGASIC / BASICTUT.LZH / LET.BAS < prev    next >
BASIC Source File  |  1980-01-01  |  7KB  |  132 lines

  1. 10 REM MARK A. SWANSON     20:41:32  02-24-85
  2. 20 CLS
  3. 30 FOR A=1 TO 50:PRINT "       L E T   ";:NEXT A
  4. 40 PRINT
  5. 50 PRINT "------------------------------------------------------------------------------"
  6. 60 PRINT:PRINT:PRINT:PRINT
  7. 70 PRINT "                                       LET
  8. 80 PRINT:PRINT
  9. 90 PRINT "                             A STATEMENT FOR STORAGE
  10. 100 FOR A=1 TO 2000:NEXT A
  11. 110 CLS
  12. 120 PRINT "            LET is a versitile STATEMENT used for storing STRINGS and
  13. 130 PRINT "            numeric values.  Without LET, the computer assumes that
  14. 140 PRINT "            only LINE NUMBERS and their data are to be stored.  LET
  15. 150 PRINT "            can be used with almost every other STATEMENT, but we will
  16. 160 PRINT "            only use it with PRINT and GOTO in this lesson and then
  17. 170 PRINT "            apply it with new STATEMENTs in later lessons.
  18. 180 PRINT
  19. 190 PRINT "            The best way to understand LET is to use it in a simple
  20. 200 PRINT "            program.....
  21. 210 PRINT 
  22. 220 PRINT "                                    10 LET A=106
  23. 230 PRINT "                                    20 PRINT A
  24. 240 PRINT
  25. 250 PRINT "            The output would be.....
  26. 260 PRINT 
  27. 270 PRINT "                                    106
  28. 280 PRINT 
  29. 290 PRINT "            The computer was instructed to store the number '106' as
  30. 300 PRINT "            'A'.  Then, as instructed in line 20, the computer PRINTed
  31. 310 PRINT "            the VALUE of 'A' - which is '106'.
  32. 320 PRINT:PRINT
  33. 330 INPUT "                   PRESS [RETURN] TO CONTINUE  or  [Q] MAIN BTMENU ",Z$
  34. 340 IF Z$="Q" THEN LOAD"B:BTMENU.BAS",R
  35. 350 CLS
  36. 360 PRINT "            We can use LET to do math problems, as is illustrated in
  37. 370 PRINT "            the following example.....
  38. 380 PRINT
  39. 390 PRINT "                                      10 LET A=24*17
  40. 400 PRINT "                                      20 PRINT A
  41. 410 PRINT
  42. 420 PRINT "            The output would be.....
  43. 430 PRINT
  44. 440 PRINT "                                      408
  45. 450 PRINT
  46. 460 PRINT "            The computer was instructed to store the VALUE of '24 X 17'.
  47. 470 PRINT "            Then, as instructed in line 20, the VALUE was PRINTed - 408.
  48. 480 PRINT
  49. 490 PRINT "            The letter used for storing VALUES is called the VARIABLE.
  50. 500 PRINT "            We used the VARIABLE 'A', however any letter or combination
  51. 510 PRINT "            of letters is acceptable.
  52. 520 PRINT:PRINT:PRINT:PRINT
  53. 530 INPUT "           PRESS [RETURN] TO CONTINUE  [P] PREVIOUS PAGE  [Q] MAIN BTMENU ",Z$
  54. 540 IF Z$="P" THEN GOTO 110
  55. 550 IF Z$="Q" THEN LOAD"B:BTMENU.BAS",R
  56. 560 CLS
  57. 570 PRINT "           Now, we'll use LET with STRINGs (letters, words, anything
  58. 580 PRINT "           that is to be PRINTed or stored verbatim).  A minor addition
  59. 590 PRINT "           to the format is necessary.  Whenever a STRING is to be stored,
  60. 600 PRINT "           a dollar sign ($) has to be added to the VARIABLE.  This makes
  61. 610 PRINT "           it a STRING VARIABLE.  Another example.....
  62. 620 PRINT
  63. 630 PRINT "                                  10 LET G$=''BASIC IS FUN''
  64. 640 PRINT "                                  20 PRINT G$
  65. 650 PRINT
  66. 660 PRINT "           The output would be.....
  67. 670 PRINT 
  68. 680 PRINT "                                  BASIC IS FUN
  69. 690 PRINT
  70. 700 PRINT "           Notice that the data was enclosed in quotations.  Remember,
  71. 710 PRINT "           whenever we store a STRING, the data must be enclosed in
  72. 720 PRINT "           quotations.
  73. 730 PRINT:PRINT:PRINT:PRINT
  74. 740 INPUT "          PRESS [RETURN] TO CONTINUE  [P] PREVIOUS PAGE  [Q] MAIN BTMENU ",Z$
  75. 750 IF Z$="P" THEN GOTO 350
  76. 760 IF Z$="Q" THEN LOAD"B:BTMENU.BAS",R
  77. 770 CLS
  78. 780 PRINT "           If you can remember back to the GOTO lesson, we used the
  79. 790 PRINT "           semi-colon (;) to PRINT data horizontally instead of 
  80. 800 PRINT "           vertically.  The following are examples of how to use the
  81. 810 PRINT "           semi-colon with LET and PRINT.....
  82. 820 PRINT
  83. 830 PRINT "                               10 LET T=18
  84. 840 PRINT "                               20 LET R=15
  85. 850 PRINT "                               30 PRINT ''THE ANSWER IS '';T+R
  86. 860 PRINT "                   output..... THE ANSWER IS 33
  87. 870 PRINT:PRINT
  88. 880 PRINT "                               10 LET W$=''WORDS''
  89. 890 PRINT "                               20 LET M$=''MY''
  90. 900 PRINT "                               30 LET T$=''TOGETHER''
  91. 910 PRINT "                               40 LET R$=''RUN''
  92. 920 PRINT "                               50 PRINT M$;W$;R$;T$
  93. 930 PRINT "                   output..... MYWORDSRUNTOGETHER
  94. 940 PRINT 
  95. 950 PRINT "           You can create your own variations of these when you practice.
  96. 960 PRINT:PRINT:PRINT
  97. 970 INPUT "           PRESS [RETURN] TO CONTINUE  [P] PREVIOUS PAGE  [Q] MAIN BTMENU ",Z$
  98. 980 IF Z$="P" THEN GOTO 560
  99. 990 IF Z$="Q" THEN LOAD"B:BTMENU.BAS",R
  100. 1000 CLS
  101. 1010 PRINT "IN SUMMARY.....
  102. 1020 PRINT
  103. 1030 PRINT "      1.  LET instructs the computer to store numeric values and STRINGs
  104. 1040 PRINT "          to a VARIABLE.
  105. 1050 PRINT "      2.  A dollar sign ($) must be added to the VARIABLE when storing
  106. 1060 PRINT "          STRINGs and the data must be enclosed in quotations.
  107. 1070 PRINT
  108. 1080 PRINT "------------------------------------------------------------------------------"
  109. 1090 PRINT "FOR PRACTICE.....
  110. 1100 PRINT
  111. 1110 PRINT "      1.  Try variations of the previous examples.
  112. 1120 PRINT "      2.  Combine STRINGs and numeric values in one program.
  113. 1130 PRINT "      3.  Try a program using a comma (,) instead of a semi-colon (;).
  114. 1140 PRINT
  115. 1150 PRINT "------------------------------------------------------------------------------"
  116. 1160 PRINT:PRINT:PRINT:PRINT:PRINT
  117. 1170 INPUT "             PRESS [Z] TO PRACTICE  [P] PREVIOUS PAGE  [Q] MAIN BTMENU " ,Z$
  118. 1180 IF Z$="P" THEN GOTO 770 
  119. 1190 IF Z$="Q" THEN LOAD"B:BTMENU.BAS",R
  120. 1200 CLS
  121. 1210 PRINT "               To begin practicing, type NEW, followed by [RETURN]
  122. 1220 PRINT
  123. 1230 PRINT "Try this program.....
  124. 1240 PRINT "                           10 LET A=A+1
  125. 1250 PRINT "                           20 PRINT A
  126. 1260 PRINT "                           30 GOTO 10
  127. 1270 PRINT
  128. 1280 PRINT "           To stop this program, press [CTRL]-[C] (at same time)
  129. 1290 PRINT
  130. 1300 PRINT " Remember, when using STRINGs, use quotations instead of double apostrophies.
  131. 1310 PRINT "-------------------------------------------------------------------------------"
  132.